﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Survey.Models.Where
{
    public class GradeWhere: IEFWhere<CourseEvaluate>
    {
        public int? Page { get; set; }
        public int? Limit { get; set; }
        public string? Grade { get; set; }
        public string? Class { get; set; }

        public IQueryable<CourseEvaluate> Process(IQueryable<CourseEvaluate> query, out int count)
        {
            if (!string.IsNullOrEmpty(Grade))
            {
                query = query.Where(x => x.Grade == Grade);
            }
            if (!string.IsNullOrEmpty(Class))
            {
                query = query.Where(x => x.Class == Class);
            }
            count = query.Count();
            return query;
        }
    }
}
